/*
 * MyInfo.java
 *
 * Created on 29 de Junho de 2005, 20:02
 */

package jhub.text;
import java.text.*;

import jhub.DCProtocol;
/**
 *
 * @author  botelhodaniel
 */
public class MyINFOMessage extends DCRawCommand{
    
    private String nick;
    private String description;
    private Long sharesize;
    private String speed;
    private String email;
    
    /** Creates a new instance of UserInfo */
    public MyINFOMessage(String command) throws ParseException{
        super(command);
        parse();
    }
    
    private void parse() throws ParseException{
        Object[] o = new MessageFormat(DCProtocol.MYINFO_FORMAT).parse(command.toString());
        nick = o[0].toString();
        description = o[1].toString();
        speed = o[2].toString();
        email = o[3].toString();
        setSharesize(Long.valueOf(o[4].toString()));
    }
    
    public String getNick(){
        return nick;
    }
    
    
    /**
     * @return Returns the description.
     */
    public String getDescription() {
        return description;
    }
    
    /**
     * @param description The description to set.
     */
    public void setDescription(String description) {
        this.description = description;
    }
    
    /**
     * @return Returns the email.
     */
    public String getEmail() {
        return email;
    }
    
    /**
     * @param email The email to set.
     */
    public void setEmail(String email) {
        this.email = email;
    }
    
    /**
     * @return Returns the speed.
     */
    public String getSpeed() {
        return speed;
    }
    
    /**
     * @param speed The speed to set.
     */
    public void setSpeed(String speed) {
        this.speed = speed;
    }
    
    
    /**
     * @param nick The nick to set.
     */
    public void setNick(String nick) {
        this.nick = nick;
    }

    public Long getSharesize() {
        return sharesize;
    }

    public void setSharesize(Long sharesize) {
        this.sharesize = sharesize;
    }

    public boolean equals(MyINFOMessage other){
        return other.getNick().equals(nick) && 
                other.getDescription().equals(description) && 
                other.getSharesize().equals(sharesize) &&
                other.getSpeed().equals(speed) && 
                other.getEmail().equals(email);
    }
    
}
